<!-- 出库订单详情 -->
<template>
  <div class="page-container" v-loading="loading" v-loadingCommonStyle>
    <ex_header_spiler :title="$tt('label_base_info')" />
    <ex_super_desc :model="baseModel" :data="form" size="default" direction="vertical" :attrs="$defaultDetailDescAttrs" border
      class="desc_flex_row" labelClassName="flex_cell" contentClassName="flex_cell">
    </ex_super_desc>
    <ex_header_spiler :title="$tt('label_tms_waybill_carrier_info')" />
    <ex_super_table :model="SegmentModel" :data="form.carrierAndDriverDTOList">
    </ex_super_table>
    <ex_header_spiler :title="$tt('label_tms_waybill_product_detail')" />
    <ex_super_table :model="RelationModel" :data="form.waybillSkuDetailDTOList">
    </ex_super_table>
  </div>
</template>
<script>
import router_params from '@/mixin/router_params';

export default {
  title: "label_tms_waybill_order_view",
  mixins: [router_params],
  components: {},
  data() {
    return {
      loading: false,
      form: {},
      baseModel: [
        { key: 'waybillCode', label: 'label_tms_waybill_waybill_number', },
        { key: 'transportSection', label: 'label_tms_waybill_waybill_type', formatter: (r, c, v) => this.$enumShow(v, 'TransportSectionEnum') },
        { key: 'transportType', label: 'label_tms_waybill_transport_mode', formatter: (r, c, v) => this.$enumShow(v, 'LogisticsProductsTypeEnum') },
        { key: 'trackNumber', label: 'label_tms_waybill_logistics_tracking_no', },
        { key: 'status', label: 'label_tms_waybill_waybill_main_status', formatter: (r, c, v) => this.$enumShow(v, 'TmsWaybillStatusEnum') },
        { key: 'isBreakUp', label: 'label_tms_waybill_split', formatter: (r, c, v) => this.$enumShow(v, 'YesOrNoEnum') },
        { key: 'originAddress', label: 'label_tms_waybill_dispatch_addr',
          render: (h, { data }) => {
                return h('span', {},`${data.originProvinceName||''}-${data.originCityName||''}-${data.originCountyName||''}-${data.originAddress||''}`)
          } },
        { key: 'destinationAddress', label: 'label_tms_waybill_end_addr',
          render: (h, { data }) => {
                return h('span', {},`${data.destinationProvinceName||''}-${data.destinationCityName||''}-${data.destinationCountyName||''}-${data.destinationAddress||''}`)
          } },
        { key: 'auCarrierName', label: 'label_tms_waybill_assign_carrier_name', },
        { key: 'customerName', label: 'label_customer_name', },
        { key: 'schemeName', label: 'label_tms_track_transport_name', },
        { key: 'esArrivalTime', label: 'label_tms_waybill_arrival_time',  formatter: (r, c, v) => this.$dateFormat(v)},
        { key: 'acArrivalTime', label: 'label_tms_waybill_actual_time', },
        { key: 'totalQuantity', label: 'label_tms_waybill_total_unit_quantity', },
        { key: 'totalBox', label: 'label_tms_waybill_total_cartons', },
        { key: 'totalWeight', label: 'label_tms_waybill_total_weight', },
        { key: 'totalVolume', label: 'label_tms_waybill_total_volume', },
        { key: 'remark', label: 'label_remark', },
        { key: 'receiptUserName', label: 'label_tms_receipt_consignee_name', },
        { key: 'receiptContacts', label: 'label_tms_track_consignee_phone', },
        { key: 'shipperUserName', label: 'label_tms_waybill_consigner_name', },
        { key: 'shipperContacts', label: 'label_tms_track_consigner_phone', },
        { key: 'logisticsProductsName', label: 'label_tms_waybill_logistics_product_name', },
        { key: 'isReceipt', label: 'label_tms_waybill_waybill_upload', },
        { key: 'isDelivery', label: 'label_tms_waybill_pick_upload', },
        { key: 'transportSection', label: 'label_tms_waybill_route_segmentation', formatter: (r, c, v) => this.$enumShow(v, 'TransportSectionEnum') },
        { key: 'driverName', label: 'label_tms_waybill_driver_name', },
        { key: 'driverPhone', label: 'label_tms_waybill_driver_phone', },
        // { key: 'viceDriverName', label: 'label_tms_waybill_assistant_driver_name', },
        // { key: 'viceDriverPhone', label: 'label_tms_waybill_assistant_driver_phone', },
        { key: 'vehicleNo', label: 'label_tms_waybill_license_number', },
        { key: 'isPeer', label: 'label_tms_waybill_whether_to_transfer', },
        { key: 'originPostalCode', label: 'label_tms_waybill_origin_postcode', },
        { key: 'destinationPostalCode', label: 'label_tms_waybill_destination_postcode', },
        { key: 'wmsPackagingQty', label: 'label_tms_waybill_total_wmsPackagingQty', if: () => this.transportSection != "PICK_UP_GOODS",},
        { key: 'wmsBoxQty', label: 'label_tms_waybill_total_wmsBoxQty', if: () => this.transportSection != "PICK_UP_GOODS",},
        { key: 'wmsWeight', label: 'label_tms_waybill_total_wmsWeight', if: () => this.transportSection != "PICK_UP_GOODS",},
        { key: 'wmsVolumn', label: 'label_tms_waybill_total_wmsVolumn', if: () => this.transportSection != "PICK_UP_GOODS",},
        { key: 'wmsWarehouseName', label: 'label_tms_waybill_total_wmsWarehouseName', if: () => this.transportSection != "PICK_UP_GOODS",},
      ],
      SegmentModel: [
        { key: 'waybillTaskCode', label: 'label_tms_task_number', },
        { key: 'carrierName', label: 'label_tms_waybill_carrier_name', },
        { key: 'configTypeName', label: 'label_tms_config_type', },
        { key: 'prescription', label: 'label_tms_track_prescription_time',},
        { key: 'driverName', label: 'label_driver_name' },
        { key: 'driverPhone', label: 'label_car_number', },
        { key: 'vehicleNo', label: 'label_tms_driver_phone_number', },
      ],
      RelationModel: [

        { key: 'skuBarcode', label: 'label_sku_code', },
        { key: 'skuName', label: 'label_sku_name', },


        { key: 'skuNameEn', label: 'label_sku_name', },
        { key: 'quantity', label: 'label_tms_track_pkgs', },
        { key: 'weight', label: 'label_tms_track_weight', },
        { key: 'volume', label: 'label_tms_track_volume', },
        { key: 'skuUnit', label: 'label_tms_waybill_unit', },
        { key: 'skuPrice', label: 'label_tms_waybill_unit_cost', },
        { key: 'boxNo', label: 'label_box_code', },

        // { key: 'pickUpQuantity', label: 'label_tms_waybill_deliveries_num', },
        // { key: 'pickUpBox', label: 'label_tms_waybill_pick_num', },
        // { key: 'isPickUpExceptional', label: 'label_tms_waybill_pick_exception', },
        // { key: 'signQuantity', label: 'label_tms_waybill_signed_num', },
        // { key: 'signBox', label: 'label_tms_waybill_signed_pick', },
        // { key: 'isSignExceptional', label: 'label_tms_waybill_signed_exception', },

      ],
    };
  },

  computed: {

  },

  methods: {
    init_data_default(into_params) {
      this.$emit("tagModifyLabel", { _key: 'label_name_code', name: "运单详情", code:into_params.code || "" })


      if (into_params.id) {
        this.loading = true
        this.$ajax({
          url: "/tms-api/waybill/TmsWaybillInfoQueryRpc/detail.json",
          method: 'post',
          data: { id: into_params.id },
          success: (res) => {
            this.loading = false
            this.form = Object.assign({}, res.data)
          }
        })
      }
    },

  }
};

</script>
<style></style>
